package com.broada.apm.entity;

import java.util.Date;

import com.broada.apm.cache.AlertSevertiyManager;
import com.broada.apm.cache.AlertStatusManager;
import com.broada.apm.cache.AlertTypeManager;
import com.broada.apm.model.Alert;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 告警信息
 * 
 * @author liss Create By 2014年11月21日 下午3:56:49
 */
public class Alarm {

	public String getId() {
		return raw.getId();
	}

	public String getType() {
		return raw.getType();
	}

	public String getApplicationId() {
		return raw.getApplicationId();
	}

	public String getDesc() {
		return raw.getDesc();
	}

	public int getRepeat() {
		return raw.getRepeat();
	}

	public int getSeverity() {
		return raw.getSeverity();
	}

	public String getResourceId() {
		return raw.getResourceId();
	}

	public Date getFirstTime() {
		return raw.getFirstTime();
	}

	public Date getLastTime() {
		return raw.getLastTime();
	}

	public String getServiceId() {
		return raw.getServiceId();
	}

	public String getSource() {
		return raw.getSource();
	}

	public int getStatus() {
		return raw.getStatus();
	}
	public int getClearStatus(){
		return raw.getClearStatus();
	}
	public String getTitle() {
		return raw.getTitle();
	}
	public int getThresholdTime() {
		return raw.getThresholdTime();
	}

	private Alert raw = null;

	public Alarm() {
		raw = new com.broada.apm.model.Alert();
	}

	public static Alarm wrap(com.broada.apm.model.Alert alert) {
		Alarm alarm = new Alarm();
		alarm.raw = alert;
		return alarm;
	}

	public com.broada.apm.model.Alert unwrap() {
		return raw;
	}

	@JsonIgnore
	public String getAlertTypeName() {
		return AlertTypeManager.getInstance().get(getType());
	}
	@JsonIgnore
	public String getAlertStatusName() {
		return AlertStatusManager.getInstance().get(getStatus()).getName();
	}
	@JsonIgnore
	public String getAlertSevertiyName() {
		return AlertSevertiyManager.getInstance().get(getSeverity()).getName();
	}
}
